//
//  MeSettingDevCtlCell.m
//  YSSmartHome
//
//  Created by yanghao on 2016/10/28.
//  Copyright © 2016年 yahaong. All rights reserved.
//

#import "MeSettingDevCtlCell.h"
#import "ZTDevice.h"
@implementation MeSettingDevCtlCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.textLabel.font = [UIFont systemFontOfSize:15];
        self.textLabel.textColor = RGBColor(51, 51, 51);
        UIView *splitView = [[UIView alloc]init];
        [self addSubview:splitView];
        splitView.backgroundColor = RGBColor(233, 233, 233);
        [splitView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.trailing.bottom.equalTo(self);
            make.height.equalTo(1);
        }];
    }
    return self;
}

- (void)setDevice:(ZTDevice *)device {
    _device = device;
    self.textLabel.text = [device getDeviceName];
    switch (device.devType) {
        case ZTDeviceTypeOneWay0Switch:
        case ZTDeviceTypeOneWaySwitch:
        case ZTDeviceTypeTwoWay0Switch:
        case ZTDeviceTypeTwoWaySwitch:
        case ZTDeviceTypeThreeWay0Switch:
        case ZTDeviceTypeThreeWaySwitch:
        case ZTDeviceTypeFourWay0Switch:
        case ZTDeviceTypeFourWaySwitch:
        {
            self.imageView.image = [UIImage imageNamed:@"home_light_offline"];
        }
            break;
        case ZTDeviceTypeZTDoorsensor:
        {
            self.imageView.image = [UIImage imageNamed:@"home_doorsensor_offline"];
        }
            break;
        case ZTDeviceTypeOneWaySocket:
        case ZTDeviceTypeTwoWaySocket:
        case ZTDeviceTypeThreeWaySocket:
        case ZTDeviceTypeFourWaySocket:
        {
            self.imageView.image = [UIImage imageNamed:@"home_socket_offline_icon0"];
        }
            break;
        
        case ZTDeviceTypeLCCamera:
        {
            self.imageView.image = [UIImage imageNamed:@"home_camera_offline"];
        }
            break;
        case ZTDeviceTypeInfraredDetector:
        {
            self.imageView.image = [UIImage imageNamed:@"home_infraredDetector_offline"];
        }
            break;
        case ZTDeviceTypeAlarmkey:
        {
            self.imageView.image = [UIImage imageNamed:@"home_alarm_offline"];
        }
            break;
        case ZTDeviceTypeGAS:
        {
            self.imageView.image = [UIImage imageNamed:@"home_gas_offline"];
        }
            break;
        case ZTDeviceTypeSmoke:
        {
            self.imageView.image = [UIImage imageNamed:@"home_smoke_offline"];
        }
            break;
        case ZTDeviceTypeAir:
        {
            self.imageView.image = [UIImage imageNamed:@"home_air_offline"];
        }
            break;
        case ZTDeviceTypeFlooding:
        {
            self.imageView.image = [UIImage imageNamed:@"home_flooding_offline"];
        }
            break;
        case ZTDeviceTypeCurtainSingleTrack:
        case ZTDeviceTypeCurtainDoubleTrack:
        {
            self.imageView.image = [UIImage imageNamed:@"home_curtain_open_offline"];
        }
            break;
        default:
            break;
    }
}

@end
